﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Forum.Entity.Post;
using Frame.Lib.Core.Base;

namespace Forum.DAL.Post
{
    public class ForumTopicTypeDAL : BaseDAL
    {
        public bool Exist(string strName, object id, int boardID)
        {
            string sql = "select count(*) from ForumTopicType where BoardID = @p0 and [Name] = @p1";
            if (id != null && id.ToString() != "")
            {
                sql += " and ID != @p2";
            }

            int count = dbOper.Query<int>(sql, boardID, strName, id).First();
            return (count > 0) ? true : false;
        }

        public List<ForumTopicTypeInfo> GetList(string boardID)
        {
            string sql = "select * from ForumTopicType where BoardID=@p0";
            List<ForumTopicTypeInfo> list = dbOper.Query<ForumTopicTypeInfo>(sql, boardID);
            return list;
        }
    }
}
